<h2>Attendees status (<?= $event['title'] ;?>)</h2>

<table>
    <tr>
        <th>name</th><th>Status</th><th>Action</th>
    </tr>
<?php
$i=0;
foreach($eventAttendees as $attendee){
?>
    <tr>
        <td valign='middle'><?=$attendee['User']['first_name'].' '.$attendee['User']['middle_name'].' '.$attendee['User']['last_name'];?></td>
        <td valign='middle'>
            <div id="loadingDiv<?=$i;?>" style="display: none;">
                <?php echo $html->image('ajax-loader.gif'); ?>
            </div>
            <div id="status_<?=$i;?>" >
                <?php
                    if ($attendee['EventAttendee']['status'] == 1)  echo 'confirmed';
                    else  echo 'pending';
                ?>
            </div>
        </td>
        <td valign='middle'>
        
            <?php
                  echo $ajax->link('attend','/eventAttendees/attendEvent/'.$attendee['EventAttendee']['id'].'/1',array('update'=>'status_'.$i,'loading'=>"Element.show('loadingDiv".$i."');document.getElementById('status_".$i."').innerHTML=''",'loaded'=>"Element.hide('loadingDiv".$i."')"),null,false);
                  echo '<br />';
                  echo $ajax->link('set pending','/eventAttendees/attendEvent/'.$attendee['EventAttendee']['id'].'/0',array('update'=>'status_'.$i,'loading'=>"Element.show('loadingDiv".$i."');document.getElementById('status_".$i."').innerHTML=''",'loaded'=>"Element.hide('loadingDiv".$i."')"),null,false);
            ?>
        </td>
    </tr>    
<?php $i=+1; } ?>
</table>

